app = new Vue({
	el: "#app",
	data() {
		return {
			active: "待审核",
			activeNames: [],
			tabs:['待审核','已审核','已作废'],
			rows: [
				{
					name: "借支单",
					data: [
					]
				}
			]
		}
	},
	methods: {
		/*查询审批列表*/
		async query(status) {
			try {
				var form = {userid:localStorage.getItem("USERID"), status:status}
				let res = await axios.post('api/ph_approval/query', form);
				if (res.code === 200) {
					this.rows = res.data;
					//this.$toast(res.message);
				} else {
					this.rows = res.data;
					//this.$toast(res.message);
				}
			} catch (e) {
				this.$toast(axios);
				this.$toast(form);
				//this.$toast("系统异常，请与管理员联系");
			}

	  	},
		/*提交通过或驳回命令*/
		async submit(form, value) {
			try {
				let res = await axios.put(value, form);
				if (res.code === 200) {
					this.$toast(res.message);
					this.query(this.active)
				} else {
					this.$toast(res.message);
				}
			} catch (e) {
				this.$toast("系统异常，请与管理员联系");
			}

	  	},
		selectStatus(event) {
			this.active = event
			this.query(this.active)
		},
		/*返回上一个页面*/
		back() {
			window.location.href = '../service/p_desktop.html';
		},

	},
	async mounted() {
		this.query(this.active)
	}

});
